<?
    include_once('../classes/class.register.operation.php');
    
    session_start();
    
    if (isset($_POST['type']))
    {
        $registerOperation = new RegisterOperation();
        
        if($registerOperation->process())
        {
         $type = $_POST['type'];   
         if($type == 1){   
          $comtec_id_machine = $_POST['comtec_id_machine'];  
          echo "<script>loadOrders($comtec_id_machine);</script>";
         }elseif($type == 2){
          echo "<script>loadHome();</script>";   
         }elseif($type == 3){
          header('location: http://'.$_SERVER['HTTP_HOST'].'/rfmobile/panel.php');   
         }elseif($type == 4){
          echo "<script>searchOperations();</script>";
          echo "<script>goBackSearch();</script>";   
         } 
         echo "<script>alert('Operacion ingresada satisfactoriamente');</script>";
        }else
        {
          echo '<p class="error">';
          echo '<b>'.$registerOperation->show_errors().'</b>'; 
          echo '</p>';   
        }
    }
?>
